"""应用配置管理模块"""

import os
from typing import List, Optional

from pydantic import BaseSettings


class Settings(BaseSettings):
    """应用配置类"""
    
    # 应用基础配置
    app_name: str = "文本检测API"
    app_version: str = "1.0.0"
    debug: bool = False
    api_v1_str: str = "/api/v1"
    
    # 安全配置
    secret_key: str
    algorithm: str = "HS256"
    access_token_expire_minutes: int = 30
    
    # 数据库配置
    database_url: Optional[str] = None
    redis_url: str = "redis://localhost:6379/0"
    
    # 检测平台配置
    zhiwang_api_url: Optional[str] = None
    zhiwang_api_key: Optional[str] = None
    gezida_api_url: Optional[str] = None
    gezida_api_key: Optional[str] = None
    weipu_api_url: Optional[str] = None
    weipu_api_key: Optional[str] = None
    
    # 日志配置
    log_level: str = "INFO"
    log_file: str = "logs/app.log"
    
    # CORS配置
    allowed_hosts: List[str] = ["*"]
    allowed_origins: List[str] = ["*"]
    
    class Config:
        env_file = ".env"
        case_sensitive = False


# 全局配置实例
settings = Settings() 